import request from "@/utils/request";

const authAPI = {
  login: '/api/auth/login',
  account: "/api/v1/account/",
  role: "/api/v1/role/",
  group: "/api/v1/group/",
  device: "/api/v1/device_record/",
  mapinfo: "/api/v1/mapinfo/",
  permission: "/api/v1/permission/",
};
const AuthAPI = {
  /** 登录接口*/
  login(data: LoginFormData) {
    return request({
      url: authAPI.login,
      method: "post",
      data: data,
    });
  },

  /** 刷新 token 接口*/
  // refreshToken(refreshToken: string) {
  //   return request({
  //     url: `${AUTH_BASE_URL}/refresh-token`,
  //     method: "post",
  //     data: { refreshToken: refreshToken },
  //     headers: {
  //       Authorization: "no-auth",
  //     },
  //   });
  // },

  /** 注销接口*/
  // logout() {
  //   return request({
  //     url: `${AUTH_BASE_URL}/logout`,
  //     method: "delete",
  //   });
  // },

  /** 获取验证码接口*/
  // getCaptcha() {
  //   return request<any, CaptchaResult>({
  //     url: `${AUTH_BASE_URL}/captcha`,
  //     method: "get",
  //   });
  // },
};

export default AuthAPI;

/** 登录请求参数 */
export interface LoginFormData {
  /** 用户名 */
  account: string;
  /** 密码 */
  password: string;
  /** 验证码缓存key */
  // captchaKey: string;
  /** 验证码 */
  // captchaCode: string;
}


/** 验证码响应 */
export interface CaptchaResult {
  /** 验证码缓存key */
  captchaKey: string;
  /** 验证码图片Base64字符串 */
  captchaBase64: string;
}
